﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BookMS
{ 
    public partial class admin21 : Form
    {
        Model.book m_binfo = new Model.book();
        BLL.Base b_add = new BLL.Base();
        public admin21()
        {
            InitializeComponent();
        }

        private void admin21_Load(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text!=""&& textBox2.Text != ""&&textBox3.Text != ""&&textBox4.Text != ""&&textBox5.Text != "")
            {
                m_binfo.id = textBox1.Text.ToString();
                m_binfo.name = textBox2.Text.ToString();
                m_binfo.author = textBox3.Text.ToString();
                m_binfo.press = textBox4.Text.ToString();
                m_binfo.number = Convert.ToInt32(textBox5.Text);
                if (b_add.add(m_binfo)>0)
                {
                    MessageBox.Show("添加成功");
                }
                else
                {
                    MessageBox.Show("添加失败");
                }
            }
            else
            {
                MessageBox.Show("输入不允许有空！");
            }
            
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";
            textBox5.Text = "";
        }
    }
}
